const app = getApp()
import {shopByMember} from '../../../../api/shopByMember'
const util = require('../../../../utils/util')

Component({
    properties: {
        timestamp:{
            type:Number
          }
    },
    lifetimes: {
        attached() {
            // this.getshop()
        },
        ready(){
            // this.getshop()
            console.log("59532131351313515313511352135135213212312313213123123132123132");
            console.log(this.properties.timestamp);
        }
    },
    observers:{ //监听数据的更改
        "timestamp"(data){
            this.getshop()
            // console.log(data);
        //   data ===this.data.a //这里不要写this.setData({})
        }
      },
    data: {
        shopData:{}
    },
    methods: {
        jumpCustomer(){
            var _this=this
            wx.makePhoneCall({
                phoneNumber: _this.data.shopData.phone // 仅为示例，并非真实的电话号码
              })
        },
        downRefresh(){
            this.getshop()
        },
        getshop(){
           //app.userInfoReadyCallback = res => {
                shopByMember().then(res=>{
                    if (res.data) {
                    this.data.shopData = res.data;
                    this.data.shopData.logo = util.thumbnail(this.data.shopData.logo, 65, 65)
                    this.setData({
                       shopData:this.data.shopData
                    })
                    }
                })
        //  }
        },
        jumpDeatil(){
            wx.navigateTo({
                url: '/pages/goods/shopDetail/shopDetail?id='+ this.data.shopData.id + '&&logo='+this.data.shopData.logo
            })
        }

    }
});



// {header:{
//     'Authorization': app.globalData.token
// }}
